using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using BulletOnRails4NET.Models;
using Suteki.Common.Repositories;

namespace BulletOnRails4NET.Controllers
{
    public class AdminScaffoldController<CModelType> : ScaffoldController<CModelType> where CModelType : CrudModel
    { 
        public AdminScaffoldController()
        {

        }

        public AdminScaffoldController(string model_name, IRepository<CModelType> repository)
            : base(model_name, repository)
        {

        }
        //
        // GET: /AdminScaffold/


        [Authorize(Roles = "admin")]
        public override ActionResult List()
        {
            return base.List();
        }

        [Authorize(Roles = "admin")]
        public override ActionResult GetAssociationsPossibleValues()
        {
            return base.GetAssociationsPossibleValues();
        }

        [Authorize(Roles = "admin")]
        public override ActionResult GetGridData()
        {
            return base.GetGridData();
        }

        [Authorize(Roles = "admin")]
        public override ActionResult Details(int id)
        {
            return base.Details(id);
        }

        [Authorize(Roles = "admin")]
        public override ActionResult Create()
        {
            return base.Create();
        }

        //
        // POST: /Exercises/Create

        [AcceptVerbs(HttpVerbs.Post), Authorize(Roles = "admin")]
        public override ActionResult Create(FormCollection formValues)
        {
            return base.Create(formValues);
        }

        //
        // GET: /Exercises/Edit/5
        [Authorize(Roles = "admin")]
        public override JsonResult Edit(int id)
        {
            return base.Edit(id);
        }
        //
        // POST: /Exercises/Edit/5
        [AcceptVerbs(HttpVerbs.Post), Authorize(Roles = "admin")]
        public override JsonResult Edit(int id, FormCollection formValues)
        {
            return base.Edit(id, formValues);
        }

        [AcceptVerbs(HttpVerbs.Post), Authorize(Roles = "admin")]
        public override ActionResult EditMultiple(FormCollection formValues)
        {
            return base.EditMultiple(formValues);
        }

        [AcceptVerbs(HttpVerbs.Post), Authorize(Roles = "admin")]
        public override ActionResult Delete()
        {
            return base.Delete();
        }
    }
}
